<template>
  <div class="follow-up-container">
    <van-loading size="24" color="#436BFF" v-if="isLoading" class="loading" />
    <div v-else>
      <div class="follow-up-tip">您可以继续问我:</div>
      <div
        class="follow-up-content"
        v-for="suggestion in suggestions"
        @click="onClickFollowUp(suggestion.content)"
      >
        <span>{{ suggestion.content }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from "vue";

const props = defineProps({
  suggestions: {
    type: Array,
  },
  isLoading: {
    type: Boolean,
  },
});

const emits = defineEmits(["onSelectSuggestion"]);
function onClickFollowUp(content) {
  emits("onSelectSuggestion", content);
}
</script>

<style lang="less" scoped>
.follow-up-container {
  margin-top: 14px;

  .loading {
    margin-left: 8px;
  }

  .follow-up-tip {
    margin-left: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #8c8c8c;
    line-height: 22px;
  }

  .follow-up-content {
    align-items: center;
    background: #dde4ea;
    border: 1px solid rgba(10, 17, 61, 0.06);
    border-radius: 16px;
    box-sizing: content-box;
    cursor: pointer;
    display: flex;
    justify-content: center;
    margin: 0 12px 8px 12px;
    max-width: 100%;
    padding: 12px;
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;

    span {
      color: #333;
      width: auto;
      white-space: pre-line;
      margin: 0;
      color: #6b6b75;
      font-size: 14px;
      font-style: normal;
      font-weight: 500;
      line-height: 20px;
      max-width: 100%;
      word-break: break-word;
    }
  }
}
</style>
